package com.whp.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wanghp
 * @version 1.0
 * @date 2020/6/1 11:53
 */

public class Test {

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for (int i = 1; i < 14; i++) {
            list.add(i);
        }
        int count = list.size();
        int currentPage =1;
        int pageSize = 10;
        int startIndex = (currentPage - 1) * pageSize;
        int i1 = count - pageSize * currentPage < 0 ? count - (currentPage - 1) * pageSize : pageSize;
        if(i1>0){
            int i2 = startIndex + i1;
            System.out.println(startIndex);
            System.out.println( i2 );
            System.out.println(list.subList(startIndex,5).toString());
        }

    }
}
